package com.zemb.flxwear.UI.Activity;

import android.content.Intent;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;

import com.zemb.flxwear.Adapter.CategoryAdapter;
import com.zemb.flxwear.Bean.CategoryBean;
import com.zemb.flxwear.R;
import com.zemb.flxwear.Utils.DeviceUtils;

import java.util.ArrayList;
import java.util.List;

public class CategoryMeasureActivity extends AppCompatActivity {
    RecyclerView recyclerView;
    List<CategoryBean> list;
    CategoryAdapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_category_measure);
        initView();
        initData();
    }
    private void initView(){
        recyclerView = findViewById(R.id.rc_category);
    }
    private void initData(){
         adapter =new CategoryAdapter(this);
        list = new ArrayList<>();
        list.add(new CategoryBean(R.mipmap.blood_pressure_green,getResources().getString(R.string.blood_pressure), DeviceUtils.Category.BLOOD_PRESSURE));
        list.add(new CategoryBean(R.mipmap.blood_oxygen_green,getResources().getString(R.string.blood_oxygen), DeviceUtils.Category.BLOOD_OXYGEN));
        list.add(new CategoryBean(R.mipmap.blood_sugar_green,getResources().getString(R.string.blood_sugar), DeviceUtils.Category.BLOOD_SUGAR));
        list.add(new CategoryBean(R.mipmap.uric_acid_green,getResources().getString(R.string.uric_acid), DeviceUtils.Category.URIC_ACID));
        list.add(new CategoryBean(R.mipmap.static_blood_pressure_green,getResources().getString(R.string.blood_ketone), DeviceUtils.Category.BLOOD_KETONE));
        list.add(new CategoryBean(R.mipmap.cholesterol_green,getResources().getString(R.string.cholesterol), DeviceUtils.Category.CHOLESTEROL));
        list.add(new CategoryBean(R.mipmap.pulse_green,getResources().getString(R.string.ecg), DeviceUtils.Category.ECG));
        recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false));
        adapter.setList(list);
        adapter.setOnItemClickListener((v, categoryBean, position) -> {
            Intent intent = new Intent(CategoryMeasureActivity.this,MeasureActivity.class);
            intent.putExtra("tag",categoryBean.tag);
            startActivity(intent);

        });
        recyclerView.setAdapter(adapter);

    }
}